<template>
  <view>
    
    <uni-card
      v-for="(item, index) in datas.data.datas.data"
      :key="item.correct"
    >
      <view style="font-size: 16px">
        <p>
          <text > <text style="color: #029d94; font-size: 20px;"> {{index+1}}/{{ datas.data.datas.index }}
          
          
          </text>{{ item.title }}
          </text>
        </p>
        <view style="margin-top: 20px">
          <view class="sdsds" v-for="(items,indesx) in item.options"
            style="
              min-height: 30px;
              padding: 5px;
              margin: 10px 0;
              display: flex;
              justify-content: space-between;
              line-height: 30px;
              border-radius: 5px;
            "
          :class="{bians:item.correct==indesx+1,
            reds:datas.data.datas.xuanzeshuju[index]==indesx+1}"
          >
          {{ datas.data.datas.xuanzeshuju[index] }}
          {{ item.correct }}
          {{ indesx }}
            {{ items.text }}
            <uni-icons
            v-if="item.correct==indesx+1"
              style="float: right"
              type="checkmarkempty"
              color="#029d94"
              size="20"
            ></uni-icons>
            <uni-icons
            v-if="datas.data.datas.xuanzeshuju[index]==indesx+1&&item.correct!==indesx+1"
              style="float: right"
              type="closeempty"
              color="red"
              size="20"
            ></uni-icons>
          </view>
       
        </view>
      </view>
      <p v-if="!datas.data.datas.xuanzeshuju.length" style="text-align: center; color: red;">
        您未作答!
      </p>
    </uni-card>
  </view>
</template>

<script setup lang="ts">
import { getCurrentInstance, reactive} from "vue";
let datas: any = reactive({
  data: [],
});

const huil = () => {
  uni.navigateTo({
    url: `/subpkg/huikan/index`,
    success: function (res: any) {
      // 通过eventChannel向被打开页面传送数据
      res.eventChannel.emit(
        "acceptDataFromOpenerPage",

        {datas}
      );
    },
  });
};
const instance = getCurrentInstance()?.proxy;
// @ts-ignore
const eventChannel = instance.getOpenerEventChannel();

eventChannel.on("acceptDataFromOpenerPage", function (data: any) {
  datas.data = data;
});
</script>

<style scoped>
.sdsds{
  border: 1px solid #666;
}
.reds{
  border: 1px solid red;
}
.bians{border: 1px solid #029d94 !important;}
</style>
